<!--
 * @Description: 
 * @Version: V1.0.0
 * @Author: 周艳凯 484894717@qq.com
 * @Date: 2024-09-27 16:48:55
 * @LastEditors: 周艳凯 484894717@qq.com
 * @LastEditTime: 2024-10-24 14:41:17
 * @FilePath: index.vue
 * Copyright 2024 Marvin, All Rights Reserved. 
 * 2024-09-27 16:48:55
-->
<template>
  <view :class="classNames" :style="mergedStyles">
    <text :class="['arco-divider-text', `arco-divider-text-${orientation}`]"
      ><slot></slot
    ></text>
  </view>
</template>

<script lang="ts">
import { computed, defineComponent } from "vue";
import { isNumber, isUndefined } from "@/utils/is";
const icon = defineComponent({
  name: "Card",
  options: {
    // 虚拟化节点
    virtualHost: true,
  },
  props: {
    direction: {
      type: String,
      default: "horizontal",
    },
    orientation: {
      type: String,
      default: "center",
    },
    type: {
      type: String,
    },
    size: {
      type: Number,
    },
    margin: {
      type: [Number, String],
    },
  },
  emits: ["update:visible", "ok", "cancel"],
  setup(props, { slots }) {
    const prefixCls = "arco-divider";

    const isHorizontal = computed(() => props.direction === "horizontal");

    const mergedStyles = computed(() => {
      const styles: any = {};
      if (props.size) {
        styles[
          isHorizontal.value ? "border-bottom-width" : "border-left-width"
        ] = isNumber(props.size) ? `${props.size}px` : props.size;
      }
      if (props.type) {
        styles[
          isHorizontal.value ? "border-bottom-style" : "border-left-style"
        ] = props.type;
      }
      if (!isUndefined(props.margin)) {
        const margin = isNumber(props.margin)
          ? `${props.margin}px`
          : props.margin;
        styles.margin = isHorizontal.value ? `${margin} 0` : `0 ${margin}`;
      }
      return styles;
    });

    const children = computed(() => {
      return Boolean(slots.default);
    });

    const classNames = computed(() => {
      return [
        prefixCls,
        `${prefixCls}-${props.direction}`,
        {
          [`${prefixCls}-with-text`]: children,
        },
      ];
    });

    return {
      classNames,
      mergedStyles,
    };
  },
});
export default icon;
</script>

<style scoped lang="scss">
.arco-modal-container {
  animation: tans 0.5s ease;
}

@keyframes tans {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}
</style>
